{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "wGiExl72jSfD"
   },
   "source": [
    "[Open In Colab](https://colab.research.google.com/github/shibing624/textgen/blob/main/examples/language_generation/GPT2_Finetune_Chinese_Poem.ipynb)\n",
    "\n",
    "\n",
    "# GPT2 写诗\n",
    "- 设计：Pretrained GPT2 + “写诗 prompt” fine-tuning\n",
    "  - 对比我的 [T5 training from scratch](https://github.com/shibing624/textgen/blob/main/examples/T5/T5_Finetune_Chinese_Poem.ipynb)\n",
    "  - 想要加入作者作为可选输入\n",
    "    - 每个文章分两次输入，一次作者名字，一次“None”名字（通用）\n",
    "- 数据：[诗歌github](https://github.com/chinese-poetry/chinese-poetry)\n",
    "- 相关内容\n",
    "  - [Huggingface](https://huggingface.co/)\n",
    "  - LangZhou Chinese [MengZi T5 pretrained Model](https://huggingface.co/Langboat/mengzi-t5-base) and [paper](https://arxiv.org/pdf/2110.06696.pdf)\n",
    "  - [textgen](https://github.com/shibing624/textgen) \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "-1qVyC6tqujH"
   },
   "source": [
    "## Prepare Data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "ib8ELKoFPACz",
    "outputId": "0fad6bac-1322-4c0c-a90c-c74237edab16"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Sat Aug 13 13:03:42 2022       \n",
      "+-----------------------------------------------------------------------------+\n",
      "| NVIDIA-SMI 440.118.02   Driver Version: 440.118.02   CUDA Version: 10.2     |\n",
      "|-------------------------------+----------------------+----------------------+\n",
      "| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n",
      "| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n",
      "|===============================+======================+======================|\n",
      "|   0  Tesla V100-SXM2...  On   | 00000000:00:09.0 Off |                    0 |\n",
      "| N/A   37C    P0    36W / 300W |   6144MiB / 32510MiB |      0%      Default |\n",
      "+-------------------------------+----------------------+----------------------+\n",
      "                                                                               \n",
      "+-----------------------------------------------------------------------------+\n",
      "| Processes:                                                       GPU Memory |\n",
      "|  GPU       PID   Type   Process name                             Usage      |\n",
      "|=============================================================================|\n",
      "|    0      8396      C   ...rch/odin/anaconda3/envs/py39/bin/python  6133MiB |\n",
      "+-----------------------------------------------------------------------------+\n"
     ]
    }
   ],
   "source": [
    "!nvidia-smi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "id": "3Jn7mdTkq3Za"
   },
   "outputs": [],
   "source": [
    "IS_TEST_FLOW = True  #@param {type: \"boolean\"}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "0ZR4K8fyO7o3",
    "outputId": "eda93994-a820-483b-a898-76bcbbd5ce89"
   },
   "outputs": [],
   "source": [
    "# from google.colab import drive\n",
    "# drive.mount('/content/drive')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "id": "wW3P2Ld9jMLu"
   },
   "outputs": [],
   "source": [
    "import json\n",
    "import urllib.request\n",
    "from loguru import logger\n",
    "import pandas as pd\n",
    "!pip install -q \"tqdm>=4.36.1\" > /tmp/na\n",
    "from tqdm.notebook import tqdm\n",
    "!pip install -q chinese-converter > /tmp/na\n",
    "import chinese_converter  # 繁体到简体需要\n",
    "import pickle\n",
    "import os\n",
    "import numpy as np\n",
    "import torch\n",
    "from torch.utils.data import Dataset\n",
    "from transformers import BertTokenizerFast"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "id": "9a58tcJKk7ll"
   },
   "outputs": [],
   "source": [
    "# https://github.com/chinese-poetry/chinese-poetry\n",
    "POEM_CONTENT = {\n",
    "    'tang': {\n",
    "        'total': 58,\n",
    "        'pattern': \"https://raw.githubusercontent.com/chinese-poetry/chinese-poetry/master/json/poet.tang.{0}.json\"\n",
    "    },\n",
    "    'song': {\n",
    "        'total': 255,\n",
    "        'pattern': \"https://raw.githubusercontent.com/chinese-poetry/chinese-poetry/master/json/poet.song.{0}.json\"\n",
    "    }\n",
    "}\n",
    "\n",
    "\n",
    "def get_poems(is_test=True, verbose=True):\n",
    "    df_list = []\n",
    "    for dynasty in POEM_CONTENT:\n",
    "        size = POEM_CONTENT[dynasty]['total']\n",
    "        pbar = tqdm(total=size, desc=\"Dynasty \" + dynasty)\n",
    "        for i in range(size):\n",
    "            url = POEM_CONTENT[dynasty]['pattern'].format(i * 1000)\n",
    "            if verbose:\n",
    "                print(f\"download {url} now\")\n",
    "            df_list.append(pd.read_json(url))\n",
    "            pbar.update(1)\n",
    "    return pd.concat(df_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 99,
     "referenced_widgets": [
      "323d82ca0d4f45a4bc3a9e0c3fa7223f",
      "d791ebd524c14fb39fa057b6d768d7e1",
      "dd67da684d514c0e9104af667687ec66",
      "6fdf9feaca294f57a4bef18d4278964f",
      "efc374010b0a48bb8185cb251176a5c6",
      "70a47bb0c68244f1b2e3bd063c703204",
      "ef34932d46c24af7ba5ecfe75b66dd7d",
      "867e0bde887f4cf99642971803035856",
      "ac7cda3ef7b4438da21b97343149c342",
      "fe4e464186c34afa94351f1816565336",
      "2c7065d205de48e3be3f24e552dfe2eb",
      "edb118578ca44cffa3ed79797997ce77",
      "7bd662007194408eabd5b4adf81f73dd",
      "16b9d8d8b1154477b6feb23b76ed6f7a",
      "3286b506ffc04ab486d307d42e0ffa52",
      "0c3e05f620254eb0b9b0ba1a9e23655e",
      "8f2042c820b643669ebbbd18d61770e3",
      "babcd71231734f01b65bd59b87ab5237",
      "d9e6782917cb4db4a598efa86956e8b0",
      "619a29e3e6864583b3c83d27c4b062fa",
      "74f4c31592a14f61bd1c93880b4099a6",
      "ac4f0c8888684075bd0a5bf047763641"
     ]
    },
    "id": "GrbtEs6flK24",
    "outputId": "c44d8c4e-ba45-43dc-f61a-ae8a080b33b4"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "my_df size 311660\n"
     ]
    }
   ],
   "source": [
    "poem_file = 'poems.csv'\n",
    "if os.path.exists(poem_file):\n",
    "    df = pd.read_csv(poem_file)\n",
    "else:\n",
    "    df = get_poems(is_test=IS_TEST_FLOW, verbose=False)\n",
    "    df['concat_paragraphs'] = [''.join(map(str, l)) for l in df['paragraphs']]\n",
    "    df = df[['author', 'title', 'concat_paragraphs']]\n",
    "\n",
    "    def convert_schinese(tchinese):\n",
    "        return chinese_converter.to_simplified(tchinese)\n",
    "\n",
    "    df['s_content'] = df.apply(lambda row: convert_schinese(''.join(row.concat_paragraphs)), axis=1)\n",
    "    df['s_title'] = df.apply(lambda row: convert_schinese(''.join(row.title)), axis=1)\n",
    "    df['s_author'] = df.apply(lambda row: convert_schinese(''.join(row.author)), axis=1)\n",
    "    df.to_csv(poem_file, index=False)\n",
    "\n",
    "my_df = df.astype('string')\n",
    "my_df = my_df.dropna()\n",
    "print(\"my_df size\", len(my_df))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "id": "KVZrYrYRmBuN"
   },
   "outputs": [],
   "source": [
    "MAX_AUTHOR_CHAR = 4\n",
    "MAX_TITLE_CHAR = 12\n",
    "MIN_CONTENT_CHAR = 10\n",
    "MAX_CONTENT_CHAR = 64\n",
    "\n",
    "\n",
    "def trim_author_fn(row):\n",
    "    return row.s_author[:MAX_AUTHOR_CHAR]\n",
    "\n",
    "\n",
    "def trim_title_fn(row):\n",
    "    trimed_title = row.s_title[:MAX_TITLE_CHAR].replace(\" \", \"\").replace(\"(\", \"\").replace(\")\", \"\")\n",
    "    return trimed_title\n",
    "\n",
    "\n",
    "def trim_content_fn(row):\n",
    "    trimed_content = row.s_content[:MAX_CONTENT_CHAR]\n",
    "    return trimed_content\n",
    "\n",
    "\n",
    "# Trim the size, a soft copy to avoid the view/copy conflict warning\n",
    "my_df['s_author_trim'] = my_df.copy().apply(trim_author_fn, axis=1)\n",
    "my_df['s_title_trim'] = my_df.copy().apply(trim_title_fn, axis=1)\n",
    "my_df['s_content_trim'] = my_df.copy().apply(trim_content_fn, axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "id": "4YlgJ2BznDZE"
   },
   "outputs": [],
   "source": [
    "# Title cannot be empty\n",
    "empty_title_mask = (my_df['s_title_trim'].str.len() == 0)\n",
    "too_short_cotent_mask = (my_df['s_content_trim'].str.len() <= MIN_CONTENT_CHAR)\n",
    "invalid_mask = (('无正文' == my_df['s_content_trim']) | ('无正文' == my_df['s_author_trim']))\n",
    "too_short_mask =  empty_title_mask | too_short_cotent_mask | invalid_mask\n",
    "\n",
    "qualitied_df = my_df.loc[~too_short_mask][['s_author_trim', 's_title_trim', 's_content_trim']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 143
    },
    "id": "kj00wicXAD5S",
    "outputId": "0e87b85f-a577-4d37-c91b-a0623aed7255"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>s_author_trim</th>\n",
       "      <th>s_title_trim</th>\n",
       "      <th>s_content_trim</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>186711</th>\n",
       "      <td>陆游</td>\n",
       "      <td>别张敎授归独登拟岘</td>\n",
       "      <td>小阁敞朱扉，停车暂息机。行人呼晚渡，幼妇浣秋衣。霜树欹危堞，风鸦满落晖。登临客愁裏，况是送将归。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>136328</th>\n",
       "      <td>葛胜仲</td>\n",
       "      <td>次韵叔才幽居二首其二</td>\n",
       "      <td>粗才濩落与时乖，湖海幽居一竹斋。月径清游疑不夜，风窗高趣到无怀。身闲有分白莲社，地禁无心红药...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268913</th>\n",
       "      <td>叶茵</td>\n",
       "      <td>枕簟入林僻茶瓜留客迟十韵</td>\n",
       "      <td>君顔犹少年，我发不胜帻。百岁垒一丘，主翁惊是客。</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       s_author_trim  s_title_trim  \\\n",
       "186711            陆游     别张敎授归独登拟岘   \n",
       "136328           葛胜仲    次韵叔才幽居二首其二   \n",
       "268913            叶茵  枕簟入林僻茶瓜留客迟十韵   \n",
       "\n",
       "                                           s_content_trim  \n",
       "186711   小阁敞朱扉，停车暂息机。行人呼晚渡，幼妇浣秋衣。霜树欹危堞，风鸦满落晖。登临客愁裏，况是送将归。  \n",
       "136328  粗才濩落与时乖，湖海幽居一竹斋。月径清游疑不夜，风窗高趣到无怀。身闲有分白莲社，地禁无心红药...  \n",
       "268913                           君顔犹少年，我发不胜帻。百岁垒一丘，主翁惊是客。  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "qualitied_df.sample(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "id": "JwLTpqrhAV0H"
   },
   "outputs": [],
   "source": [
    "TITLE_PROMPT = \"作诗：\"\n",
    "AUTHOR_PROMPT = \"作者：\"\n",
    "EOS_TOKEN = '</s>'\n",
    "\n",
    "\n",
    "def build_dataset_df(df, include_author=True):\n",
    "    dfc = df.copy()\n",
    "    dfc['prefix'] = TITLE_PROMPT\n",
    "    if include_author:\n",
    "        dfc['input_text'] = df['s_title_trim'] + EOS_TOKEN + AUTHOR_PROMPT + df['s_author_trim']\n",
    "    else:\n",
    "        dfc['input_text'] = df['s_title_trim']\n",
    "    dfc['target_text'] = df['s_content_trim']\n",
    "    dfc = dfc[['prefix', 'input_text', 'target_text']]\n",
    "    return dfc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 206
    },
    "id": "U7Owp1_aB4Cg",
    "outputId": "7eaa07f3-c7c3-46fc-abab-aa4fa989586b"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>prefix</th>\n",
       "      <th>input_text</th>\n",
       "      <th>target_text</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首一&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>秦川雄帝宅，函谷壮皇居。绮殿千寻起，离宫百雉余。连甍遥接汉，飞观迥凌虚。云日隐层阙，风烟出绮疎。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首二&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>岩廊罢机务，崇文聊驻辇。玉匣啓龙图，金绳披凤篆。韦编断仍续，缥帙舒还卷。对此乃淹留，欹案观坟典。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首三&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>移步出词林，停舆欣武宴。琱弓写明月，骏马疑流电。惊雁落虚弦，啼猿悲急箭。阅赏诚多美，于兹乃忘倦。</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  prefix         input_text                                       target_text\n",
       "0    作诗：  帝京篇十首一</s>作者：太宗皇帝  秦川雄帝宅，函谷壮皇居。绮殿千寻起，离宫百雉余。连甍遥接汉，飞观迥凌虚。云日隐层阙，风烟出绮疎。\n",
       "1    作诗：  帝京篇十首二</s>作者：太宗皇帝  岩廊罢机务，崇文聊驻辇。玉匣啓龙图，金绳披凤篆。韦编断仍续，缥帙舒还卷。对此乃淹留，欹案观坟典。\n",
       "2    作诗：  帝京篇十首三</s>作者：太宗皇帝  移步出词林，停舆欣武宴。琱弓写明月，骏马疑流电。惊雁落虚弦，啼猿悲急箭。阅赏诚多美，于兹乃忘倦。"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_author_title_content = build_dataset_df(qualitied_df, True)\n",
    "df_author_title_content[:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 206
    },
    "id": "LT5PfxPFDAlz",
    "outputId": "bc447cab-3aeb-46d1-9c4d-77b2287affc7"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>prefix</th>\n",
       "      <th>input_text</th>\n",
       "      <th>target_text</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首一</td>\n",
       "      <td>秦川雄帝宅，函谷壮皇居。绮殿千寻起，离宫百雉余。连甍遥接汉，飞观迥凌虚。云日隐层阙，风烟出绮疎。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首二</td>\n",
       "      <td>岩廊罢机务，崇文聊驻辇。玉匣啓龙图，金绳披凤篆。韦编断仍续，缥帙舒还卷。对此乃淹留，欹案观坟典。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首三</td>\n",
       "      <td>移步出词林，停舆欣武宴。琱弓写明月，骏马疑流电。惊雁落虚弦，啼猿悲急箭。阅赏诚多美，于兹乃忘倦。</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  prefix input_text                                       target_text\n",
       "0    作诗：     帝京篇十首一  秦川雄帝宅，函谷壮皇居。绮殿千寻起，离宫百雉余。连甍遥接汉，飞观迥凌虚。云日隐层阙，风烟出绮疎。\n",
       "1    作诗：     帝京篇十首二  岩廊罢机务，崇文聊驻辇。玉匣啓龙图，金绳披凤篆。韦编断仍续，缥帙舒还卷。对此乃淹留，欹案观坟典。\n",
       "2    作诗：     帝京篇十首三  移步出词林，停舆欣武宴。琱弓写明月，骏马疑流电。惊雁落虚弦，啼猿悲急箭。阅赏诚多美，于兹乃忘倦。"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_title_content = build_dataset_df(qualitied_df, False)\n",
    "df_title_content[:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "id": "vsAXpMJSDMdS"
   },
   "outputs": [],
   "source": [
    "merged_df = pd.concat([df_author_title_content, df_title_content])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 423
    },
    "id": "t7UAy0RNDchP",
    "outputId": "226899f6-43c3-4dd4-8936-c0c780c492fd"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>prefix</th>\n",
       "      <th>input_text</th>\n",
       "      <th>target_text</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首一&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>秦川雄帝宅，函谷壮皇居。绮殿千寻起，离宫百雉余。连甍遥接汉，飞观迥凌虚。云日隐层阙，风烟出绮疎。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首二&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>岩廊罢机务，崇文聊驻辇。玉匣啓龙图，金绳披凤篆。韦编断仍续，缥帙舒还卷。对此乃淹留，欹案观坟典。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首三&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>移步出词林，停舆欣武宴。琱弓写明月，骏马疑流电。惊雁落虚弦，啼猿悲急箭。阅赏诚多美，于兹乃忘倦。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首四&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>鸣笳临乐馆，眺听欢芳节。急管韵朱弦，清歌凝白雪。彩凤肃来仪，玄鹤纷成列。去兹郑卫声，雅音方可悦。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>帝京篇十首五&lt;/s&gt;作者：太宗皇帝</td>\n",
       "      <td>芳辰追逸趣，禁苑信多奇。桥形通汉上，峰势接云危。烟霞交隐映，花鸟自参差。何如肆辙迹？万里赏瑶池。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311850</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>状元峰</td>\n",
       "      <td>马蹄一日遍长安，萤火鸡窗千载寒。从此锦衣归故里，文峰高并彩云端。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311851</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>蜕龙洞</td>\n",
       "      <td>苍岩磊落任龙蟠，绵亘千年露未干。一自爲霖破壁去，至今风雨逼山寒。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311852</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>登竺云山</td>\n",
       "      <td>独上千峰与万峰，晴岚淡写海江容。偶从动问山居事，笑拍岩前一树松。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311853</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>寒云千叠山</td>\n",
       "      <td>松竹阴森护上方，老仙蓬髪一簪霜。闲来欹枕松风裏，归夢不知山水长。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>311854</th>\n",
       "      <td>作诗：</td>\n",
       "      <td>宣妙楼</td>\n",
       "      <td>云观烟楼是梵家，竹围如洗逼寒沙。因风绿浪摇晴麦，遇雨红香落涧花。人锁昼房听鸟语，僧归晚坞放蜂...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>620180 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       prefix         input_text  \\\n",
       "0         作诗：  帝京篇十首一</s>作者：太宗皇帝   \n",
       "1         作诗：  帝京篇十首二</s>作者：太宗皇帝   \n",
       "2         作诗：  帝京篇十首三</s>作者：太宗皇帝   \n",
       "3         作诗：  帝京篇十首四</s>作者：太宗皇帝   \n",
       "4         作诗：  帝京篇十首五</s>作者：太宗皇帝   \n",
       "...       ...                ...   \n",
       "311850    作诗：                状元峰   \n",
       "311851    作诗：                蜕龙洞   \n",
       "311852    作诗：               登竺云山   \n",
       "311853    作诗：              寒云千叠山   \n",
       "311854    作诗：                宣妙楼   \n",
       "\n",
       "                                              target_text  \n",
       "0        秦川雄帝宅，函谷壮皇居。绮殿千寻起，离宫百雉余。连甍遥接汉，飞观迥凌虚。云日隐层阙，风烟出绮疎。  \n",
       "1        岩廊罢机务，崇文聊驻辇。玉匣啓龙图，金绳披凤篆。韦编断仍续，缥帙舒还卷。对此乃淹留，欹案观坟典。  \n",
       "2        移步出词林，停舆欣武宴。琱弓写明月，骏马疑流电。惊雁落虚弦，啼猿悲急箭。阅赏诚多美，于兹乃忘倦。  \n",
       "3        鸣笳临乐馆，眺听欢芳节。急管韵朱弦，清歌凝白雪。彩凤肃来仪，玄鹤纷成列。去兹郑卫声，雅音方可悦。  \n",
       "4        芳辰追逸趣，禁苑信多奇。桥形通汉上，峰势接云危。烟霞交隐映，花鸟自参差。何如肆辙迹？万里赏瑶池。  \n",
       "...                                                   ...  \n",
       "311850                   马蹄一日遍长安，萤火鸡窗千载寒。从此锦衣归故里，文峰高并彩云端。  \n",
       "311851                   苍岩磊落任龙蟠，绵亘千年露未干。一自爲霖破壁去，至今风雨逼山寒。  \n",
       "311852                   独上千峰与万峰，晴岚淡写海江容。偶从动问山居事，笑拍岩前一树松。  \n",
       "311853                   松竹阴森护上方，老仙蓬髪一簪霜。闲来欹枕松风裏，归夢不知山水长。  \n",
       "311854  云观烟楼是梵家，竹围如洗逼寒沙。因风绿浪摇晴麦，遇雨红香落涧花。人锁昼房听鸟语，僧归晚坞放蜂...  \n",
       "\n",
       "[620180 rows x 3 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "merged_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train 613978 eval 6202\n",
      "train 300 eval 30\n"
     ]
    }
   ],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "merged_df = merged_df.sample(frac=1) # Shuffle\n",
    "train_df, eval_df = train_test_split(merged_df, test_size=0.01)\n",
    "print(\"train\", len(train_df), \"eval\", len(eval_df))\n",
    "\n",
    "train_df = train_df.sample(300) if IS_TEST_FLOW else train_df\n",
    "eval_df = eval_df.sample(30) if IS_TEST_FLOW else eval_df\n",
    "print(\"train\", len(train_df), \"eval\", len(eval_df))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "f_vxHg9MDqTj"
   },
   "source": [
    "## Modeling"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "id": "pUt4xwq6Drrn"
   },
   "outputs": [],
   "source": [
    "# Quiet install textgen package\n",
    "!pip install -q textgen"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 35
    },
    "id": "H0NHrq6AD915",
    "outputId": "eadf22c4-4f89-4185-fa7c-ee0e5b6cf0cb"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/search/odin/anaconda3/envs/py39/lib/python3.9/site-packages/text2vec/utils/get_file.py:16: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n",
      "  from tqdm.autonotebook import tqdm\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "\n",
    "sys.path.append('../..')\n",
    "from textgen.language_generation import LanguageGenerationModel\n",
    "from textgen.language_modeling import LanguageModelingModel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "id": "wg4u8ZfsEA85"
   },
   "outputs": [],
   "source": [
    "model_type = 'gpt2'\n",
    "model_name = \"uer/gpt2-distil-chinese-cluecorpussmall\"\n",
    "output_dir = 'outputs/gpt2_distil_poem/'\n",
    "max_seq_length = 50\n",
    "num_epochs = 5\n",
    "batch_size = 32\n",
    "num_return_sequences = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "def encode(data):\n",
    "    \"\"\"Encode data to src trg token ids\"\"\"\n",
    "    tokenizer, src, trg = data\n",
    "    cls_id = tokenizer.cls_token_id\n",
    "    sep_id = tokenizer.sep_token_id\n",
    "    input_ids = [cls_id] + tokenizer.encode(src, add_special_tokens=False, max_length=max_seq_length) + [sep_id] + \\\n",
    "                tokenizer.encode(trg, add_special_tokens=False, max_length=max_seq_length) + [sep_id]\n",
    "    return input_ids\n",
    "\n",
    "\n",
    "class SrcTrgDataset(Dataset):\n",
    "    \"\"\"Custom dataset, use it by dataset_class from train args\"\"\"\n",
    "\n",
    "    def __init__(self, tokenizer, args, data, mode, block_size=512, special_tokens_count=2):\n",
    "        cached_features_file = os.path.join(\n",
    "            args.cache_dir,\n",
    "            args.model_name.replace(\"/\", \"_\")\n",
    "            + \"_cached_\"\n",
    "            + str(args.max_seq_length)\n",
    "            + str(len(data)),\n",
    "        )\n",
    "\n",
    "        if os.path.exists(cached_features_file) and (\n",
    "                (not args.reprocess_input_data and not args.no_cache)\n",
    "                or (mode == \"dev\" and args.use_cached_eval_features and not args.no_cache)\n",
    "        ):\n",
    "            logger.info(f\" Loading features from cached file {cached_features_file}\")\n",
    "            with open(cached_features_file, \"rb\") as handle:\n",
    "                self.examples = pickle.load(handle)\n",
    "        else:\n",
    "            logger.info(f\" Creating features from dataset file at {args.cache_dir}\")\n",
    "            lines = [(tokenizer, input_text, target_text)\n",
    "                        for input_text, target_text in zip(data[\"input_text\"], data[\"target_text\"])\n",
    "            ]\n",
    "            self.examples = [encode(line) for line in lines]\n",
    "            logger.info(f\" Saving features into cached file {cached_features_file}\")\n",
    "            with open(cached_features_file, \"wb\") as handle:\n",
    "                pickle.dump(self.examples, handle, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "\n",
    "    def __len__(self):\n",
    "        return len(self.examples)\n",
    "\n",
    "    def __getitem__(self, item):\n",
    "        return torch.tensor(self.examples[item], dtype=torch.long)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 113,
     "referenced_widgets": [
      "f4c2d4d0e3eb483488808fccfb805039",
      "164b459cfb8a4a519e1e1dfb94ebf864",
      "275b4e7634324e51a3f2815a930046c9",
      "192177f838774e69b9dc03164e12fe3f",
      "54c2e0f0aabe4b8db056a28e8470184d",
      "04bcb8d3d0ee4cab90101a22d358cbf4",
      "d736a23a0e8f40b2bf65b3064f3513c7",
      "2b4801d6b14c4e00ba6881058ccef2c9",
      "a38e578963634fe8aaee4598915e8a63",
      "b63e60bfeeae4abc89db4684ed37ffac",
      "8ae1328f6e2a4016932f5154e5e48a46",
      "f469bbd3377e48e9a0e1f1ec447a5d4c",
      "ab58b2c948274a1e858bb27bc5db1483",
      "8d64b2cb15a544688df9b0ef4f5ac5d4",
      "3ff6b9f98fb246149676f2d0d6ea5a74",
      "2709c8c8b756415aac3244c322d0cd6e",
      "db7b430a21394d47b3f510d3cd54918d",
      "9fb2562090c4469786da59aae1c3cb50",
      "516004a73b27457d8ad8fe15256dc54b",
      "d9870f9f7cbb45758e676b3ca54f9be1",
      "09a526ec6d164b2090962a5781c3097a",
      "7d9f979f8c66439a846e7ab39b9043d7",
      "eef25f8bfc564f2bace3b033a0df5eb8",
      "3596547df9124079846a0168971218ec",
      "95ff98cd1eba4fe999654378fe90ea50",
      "d84fd422478e4498bd387d71bc6973eb",
      "22ec341fcbd140649bc29b866efbba4c",
      "6a5d1f41985540309d335af09ee3b9f8",
      "d21de94ef23b41d098c5ce073e48ad95",
      "50393dcc6d8f480fa4d75d3cd1091520",
      "af835a288f37413d86415bf06fd69524",
      "790a42639e5641219c4ea39cc9d723f9",
      "a70858676a544d869b439aa65006b647"
     ]
    },
    "id": "wcJmpBMLEFi4",
    "outputId": "4de74b24-7f74-4368-8ddb-055e45ee67b9"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:07:23.944 | DEBUG    | textgen.language_modeling.language_modeling_model:__init__:153 - Device: cuda\n"
     ]
    }
   ],
   "source": [
    "train_args = {\n",
    "    \"dataset_class\": SrcTrgDataset,\n",
    "    \"reprocess_input_data\": True,\n",
    "    \"overwrite_output_dir\": True,\n",
    "    \"block_size\": 512,\n",
    "    \"max_seq_length\": max_seq_length,\n",
    "    \"learning_rate\": 5e-6,\n",
    "    \"train_batch_size\": batch_size,\n",
    "    \"gradient_accumulation_steps\": 8,\n",
    "    \"num_train_epochs\": num_epochs,\n",
    "    \"mlm\": False,\n",
    "    \"output_dir\": output_dir,\n",
    "    \"save_best_model\": True,\n",
    "    \"evaluate_during_training\": True,\n",
    "    \"num_return_sequences\": num_return_sequences,\n",
    "}\n",
    "tokenizer = BertTokenizerFast.from_pretrained(model_name)\n",
    "model = LanguageModelingModel(model_type, model_name, args=train_args, tokenizer=tokenizer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "b8ZQq6mYEHiO",
    "outputId": "8a4c827f-4ec6-4500-cc6b-9b14773f53ee"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'input_ids': [101, 3441, 2501, 6858, 3727, 677, 8024, 2292, 1232, 2970, 756, 1314, 511, 133, 120, 161, 135, 4170, 7459, 769, 7391, 3216, 8024, 5709, 7881, 5632, 1346, 2345, 511, 102], 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.tokenizer(\"桥形通汉上，峰势接云危。</s>烟霞交隐映，花鸟自参差。\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 35
    },
    "id": "hU7L1roeEPhY",
    "outputId": "9d19da92-8533-48de-db81-319031ea6ddb"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'[CLS] 桥 形 通 汉 上 ， 峰 势 接 云 危 。 < / s > 烟 霞 交 隐 映 ， 花 鸟 自 参 差 。 [SEP]'"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.tokenizer.decode([101, 3441, 2501, 6858, 3727, 677, 8024, 2292, 1232, 2970, 756, 1314, 511, 133, 120, 161, 135, 4170, 7459, 769, 7391, 3216, 8024, 5709, 7881, 5632, 1346, 2345, 511, 102])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "def predict_now(sentences, model_dir):\n",
    "    tokenizer = BertTokenizerFast.from_pretrained(model_dir)\n",
    "    m = LanguageGenerationModel(model_type, model_dir,\n",
    "                                        args={\"max_length\": max_seq_length,\n",
    "                                              \"num_return_sequences\": num_return_sequences},\n",
    "                                        tokenizer=tokenizer)\n",
    "    for prompt in sentences:\n",
    "        generated = m.generate(prompt, verbose=False, add_cls_head=True, split_on_space=False)\n",
    "        print(\"inputs:\", prompt)\n",
    "        print(\"outputs:\", generated)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "id": "KXzTBimnFQbS"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:07:51.160 | DEBUG    | textgen.language_generation.language_generation_model:__init__:107 - Device: cuda\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inputs: 过温汤\n",
      "outputs: ['过温汤的话价格一般，菜的种类也不是太多，每次去都会点大排档的特价菜，性价比不错哦~我个人认为还不错的一']\n"
     ]
    }
   ],
   "source": [
    "predict_now([\"过温汤\"], model_name)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Training"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 413,
     "referenced_widgets": [
      "3c1198c7ce7a4093b1fdba455c074a35",
      "0df136c92bef46eb8f0234f45874d07c",
      "0d75d646fdd845c5946bffaf83c360f4",
      "5cb75bb247bf455789f3343fbf458194",
      "d7a870de29374972903edf99e079381a",
      "31c4a5dd88824e58b56b3daf05ff7c6c",
      "1b620ef6bf224e20b93cf805a75a84d9",
      "61d54ac5d2c749e482b3b6d51bc6b825",
      "f214b269fd884b1c9a3a634d6784b18e",
      "2fd2168d36e2400eb267577e6a05d7f6",
      "c8a5e24211f24c488bb8c633d20d5185",
      "ce5700274ea747a6bafeb693bffab4e7",
      "aa33dc7fea834e2ab6d18c3332cc49fc",
      "3f2a2563bd1d4824807bcde335b33ca0",
      "637c5f82daa846a3b95ce6914bd55e2b",
      "0aebb7ab6f274f569061ba2f2c01a6e7",
      "32f8fb07ad064e85b9c8fc2bbf0b0ad8",
      "54230e6b55274cecb2f6f4c034badf63",
      "e4cd150df2d34df0bc66b22f60089e4e",
      "1d32d77e984649569fb475f479b5e05a",
      "604fcc04d62d46d8b87e402401c0c924",
      "8880de85a4b14d5e9703a5df16ceb6c6"
     ]
    },
    "id": "44fzxZP3EXoa",
    "outputId": "3e7fac2d-ebbd-40f5-d564-9306827d87c1"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:19.417 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:19.492 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_50300\n",
      "/search/odin/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/optimization.py:306: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning\n",
      "  warnings.warn(\n",
      "2022-08-13 13:08:19.498 | INFO     | textgen.language_modeling.language_modeling_model:train:562 -  Training started\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7b621a44e31d4ac9a787ac206eca6198",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Epoch:   0%|          | 0/5 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:19.519 | INFO     | textgen.language_modeling.language_modeling_model:train:594 -    Starting fine-tuning.\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "1c81faaa45ab4d3b80700950512002a6",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Running Epoch 0 of 5:   0%|          | 0/10 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:20.448 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:20.457 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_5030\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "81a5fbdbd65b4b9895b5d4b26d1417e7",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Running Epoch 1 of 5:   0%|          | 0/10 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:23.998 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:24.007 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_5030\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "059248e5ef26445b980e935684f000f0",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Running Epoch 2 of 5:   0%|          | 0/10 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:26.735 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:26.743 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_5030\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "8e0b85af01e846b68c6e3413b068d582",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Running Epoch 3 of 5:   0%|          | 0/10 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:29.604 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:29.612 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_5030\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "68e3aadb800c4994a837b6e9d4985f31",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Running Epoch 4 of 5:   0%|          | 0/10 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:32.457 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:32.466 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_5030\n",
      "2022-08-13 13:08:35.312 | INFO     | textgen.language_modeling.language_modeling_model:train_model:386 -  Training of gpt2 model complete. Saved to outputs/gpt2_distil_couplet/.\n",
      "2022-08-13 13:08:35.315 | INFO     | __main__:__init__:32 -  Creating features from dataset file at cache_dir/\n",
      "2022-08-13 13:08:35.323 | INFO     | __main__:__init__:37 -  Saving features into cached file cache_dir/uer_gpt2-distil-chinese-cluecorpussmall_cached_5030\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "07af02d15bdc4969b50835a2006daf79",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Running Evaluation:   0%|          | 0/1 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:35.375 | INFO     | textgen.language_modeling.language_modeling_model:eval_model:926 - {'eval_loss': 6.89624547958374, 'perplexity': tensor(988.5562)}\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'eval_loss': 6.89624547958374, 'perplexity': tensor(988.5562)}\n"
     ]
    }
   ],
   "source": [
    "def sim_text_chars(text1, text2):\n",
    "    if not text1 or not text2:\n",
    "        return 0.0\n",
    "    same = set(text1) | set(text2)\n",
    "    m = len(same)\n",
    "    n = len(text1) if len(text1) > len(text2) else len(text2)\n",
    "    return m / n\n",
    "\n",
    "\n",
    "def count_matches(labels, preds):\n",
    "    logger.debug(f\"labels: {labels[:10]}\")\n",
    "    logger.debug(f\"preds: {preds[:10]}\")\n",
    "    match = sum([sim_text_chars(label, pred) for label, pred in zip(labels, preds)]) / len(labels)\n",
    "    logger.debug(f\"match: {match}\")\n",
    "    return match\n",
    "\n",
    "\n",
    "# Train model for pair data (format: src \\t trg)\n",
    "model.train_model(train_df, eval_file=eval_df)\n",
    "print(model.eval_model(eval_df, matches=count_matches))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Predict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2022-08-13 13:08:39.006 | DEBUG    | textgen.language_generation.language_generation_model:__init__:107 - Device: cuda\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inputs: 过温汤\n",
      "outputs: ['过温汤、清蒸、咸鱼、青鱼。为什么会变色呢？我是吃了不长时间的鱼，一个星期都不怎么长，而且每次上班都是吃青鱼']\n"
     ]
    }
   ],
   "source": [
    "predict_now([\"过温汤\"], output_dir)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "本节完。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "accelerator": "GPU",
  "colab": {
   "collapsed_sections": [],
   "machine_shape": "hm",
   "name": "RC T5 Finetune Chinese Poem Writing V1",
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "04bcb8d3d0ee4cab90101a22d358cbf4": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "09a526ec6d164b2090962a5781c3097a": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "0aebb7ab6f274f569061ba2f2c01a6e7": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_8880de85a4b14d5e9703a5df16ceb6c6",
      "placeholder": "​",
      "style": "IPY_MODEL_604fcc04d62d46d8b87e402401c0c924",
      "value": " 115/12921 [01:09&lt;2:07:50,  1.67it/s, loss=6.09, v_num=0, train_loss=6.010]"
     }
    },
    "0c3e05f620254eb0b9b0ba1a9e23655e": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_ac4f0c8888684075bd0a5bf047763641",
      "placeholder": "​",
      "style": "IPY_MODEL_74f4c31592a14f61bd1c93880b4099a6",
      "value": " 255/255 [02:08&lt;00:00,  4.82it/s]"
     }
    },
    "0d75d646fdd845c5946bffaf83c360f4": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_1b620ef6bf224e20b93cf805a75a84d9",
      "placeholder": "​",
      "style": "IPY_MODEL_31c4a5dd88824e58b56b3daf05ff7c6c",
      "value": "Validation sanity check:   0%"
     }
    },
    "0df136c92bef46eb8f0234f45874d07c": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": "inline-flex",
      "flex": null,
      "flex_flow": "row wrap",
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": "100%"
     }
    },
    "164b459cfb8a4a519e1e1dfb94ebf864": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "16b9d8d8b1154477b6feb23b76ed6f7a": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_babcd71231734f01b65bd59b87ab5237",
      "placeholder": "​",
      "style": "IPY_MODEL_8f2042c820b643669ebbbd18d61770e3",
      "value": "Dynasty song: 100%"
     }
    },
    "192177f838774e69b9dc03164e12fe3f": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_a38e578963634fe8aaee4598915e8a63",
      "max": 725135,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_2b4801d6b14c4e00ba6881058ccef2c9",
      "value": 725135
     }
    },
    "1b620ef6bf224e20b93cf805a75a84d9": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "1d32d77e984649569fb475f479b5e05a": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": "2",
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "22ec341fcbd140649bc29b866efbba4c": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_a70858676a544d869b439aa65006b647",
      "placeholder": "​",
      "style": "IPY_MODEL_790a42639e5641219c4ea39cc9d723f9",
      "value": " 990M/990M [00:29&lt;00:00, 38.5MB/s]"
     }
    },
    "2709c8c8b756415aac3244c322d0cd6e": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_7d9f979f8c66439a846e7ab39b9043d7",
      "placeholder": "​",
      "style": "IPY_MODEL_09a526ec6d164b2090962a5781c3097a",
      "value": " 659/659 [00:00&lt;00:00, 18.4kB/s]"
     }
    },
    "275b4e7634324e51a3f2815a930046c9": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_d736a23a0e8f40b2bf65b3064f3513c7",
      "placeholder": "​",
      "style": "IPY_MODEL_04bcb8d3d0ee4cab90101a22d358cbf4",
      "value": "Downloading: 100%"
     }
    },
    "2b4801d6b14c4e00ba6881058ccef2c9": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "2c7065d205de48e3be3f24e552dfe2eb": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "2fd2168d36e2400eb267577e6a05d7f6": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "31c4a5dd88824e58b56b3daf05ff7c6c": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "323d82ca0d4f45a4bc3a9e0c3fa7223f": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_dd67da684d514c0e9104af667687ec66",
       "IPY_MODEL_6fdf9feaca294f57a4bef18d4278964f",
       "IPY_MODEL_efc374010b0a48bb8185cb251176a5c6"
      ],
      "layout": "IPY_MODEL_d791ebd524c14fb39fa057b6d768d7e1"
     }
    },
    "3286b506ffc04ab486d307d42e0ffa52": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_619a29e3e6864583b3c83d27c4b062fa",
      "max": 255,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_d9e6782917cb4db4a598efa86956e8b0",
      "value": 255
     }
    },
    "32f8fb07ad064e85b9c8fc2bbf0b0ad8": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "3596547df9124079846a0168971218ec": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "3c1198c7ce7a4093b1fdba455c074a35": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_0d75d646fdd845c5946bffaf83c360f4",
       "IPY_MODEL_5cb75bb247bf455789f3343fbf458194",
       "IPY_MODEL_d7a870de29374972903edf99e079381a"
      ],
      "layout": "IPY_MODEL_0df136c92bef46eb8f0234f45874d07c"
     }
    },
    "3f2a2563bd1d4824807bcde335b33ca0": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_54230e6b55274cecb2f6f4c034badf63",
      "placeholder": "​",
      "style": "IPY_MODEL_32f8fb07ad064e85b9c8fc2bbf0b0ad8",
      "value": "Epoch 0:   1%"
     }
    },
    "3ff6b9f98fb246149676f2d0d6ea5a74": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_d9870f9f7cbb45758e676b3ca54f9be1",
      "max": 659,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_516004a73b27457d8ad8fe15256dc54b",
      "value": 659
     }
    },
    "50393dcc6d8f480fa4d75d3cd1091520": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "516004a73b27457d8ad8fe15256dc54b": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "54230e6b55274cecb2f6f4c034badf63": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "54c2e0f0aabe4b8db056a28e8470184d": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_8ae1328f6e2a4016932f5154e5e48a46",
      "placeholder": "​",
      "style": "IPY_MODEL_b63e60bfeeae4abc89db4684ed37ffac",
      "value": " 725k/725k [00:00&lt;00:00, 8.18MB/s]"
     }
    },
    "5cb75bb247bf455789f3343fbf458194": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "danger",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_f214b269fd884b1c9a3a634d6784b18e",
      "max": 2,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_61d54ac5d2c749e482b3b6d51bc6b825",
      "value": 0
     }
    },
    "604fcc04d62d46d8b87e402401c0c924": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "619a29e3e6864583b3c83d27c4b062fa": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "61d54ac5d2c749e482b3b6d51bc6b825": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "637c5f82daa846a3b95ce6914bd55e2b": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_1d32d77e984649569fb475f479b5e05a",
      "max": 12921,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_e4cd150df2d34df0bc66b22f60089e4e",
      "value": 115
     }
    },
    "6a5d1f41985540309d335af09ee3b9f8": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "6fdf9feaca294f57a4bef18d4278964f": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_ac7cda3ef7b4438da21b97343149c342",
      "max": 58,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_867e0bde887f4cf99642971803035856",
      "value": 58
     }
    },
    "70a47bb0c68244f1b2e3bd063c703204": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "74f4c31592a14f61bd1c93880b4099a6": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "790a42639e5641219c4ea39cc9d723f9": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "7bd662007194408eabd5b4adf81f73dd": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "7d9f979f8c66439a846e7ab39b9043d7": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "867e0bde887f4cf99642971803035856": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "8880de85a4b14d5e9703a5df16ceb6c6": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "8ae1328f6e2a4016932f5154e5e48a46": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "8d64b2cb15a544688df9b0ef4f5ac5d4": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_9fb2562090c4469786da59aae1c3cb50",
      "placeholder": "​",
      "style": "IPY_MODEL_db7b430a21394d47b3f510d3cd54918d",
      "value": "Downloading: 100%"
     }
    },
    "8f2042c820b643669ebbbd18d61770e3": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "95ff98cd1eba4fe999654378fe90ea50": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_d21de94ef23b41d098c5ce073e48ad95",
      "placeholder": "​",
      "style": "IPY_MODEL_6a5d1f41985540309d335af09ee3b9f8",
      "value": "Downloading: 100%"
     }
    },
    "9fb2562090c4469786da59aae1c3cb50": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "a38e578963634fe8aaee4598915e8a63": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "a70858676a544d869b439aa65006b647": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "aa33dc7fea834e2ab6d18c3332cc49fc": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": "inline-flex",
      "flex": null,
      "flex_flow": "row wrap",
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": "100%"
     }
    },
    "ab58b2c948274a1e858bb27bc5db1483": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "ac4f0c8888684075bd0a5bf047763641": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "ac7cda3ef7b4438da21b97343149c342": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "af835a288f37413d86415bf06fd69524": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "b63e60bfeeae4abc89db4684ed37ffac": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "babcd71231734f01b65bd59b87ab5237": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "c8a5e24211f24c488bb8c633d20d5185": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "ce5700274ea747a6bafeb693bffab4e7": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_3f2a2563bd1d4824807bcde335b33ca0",
       "IPY_MODEL_637c5f82daa846a3b95ce6914bd55e2b",
       "IPY_MODEL_0aebb7ab6f274f569061ba2f2c01a6e7"
      ],
      "layout": "IPY_MODEL_aa33dc7fea834e2ab6d18c3332cc49fc"
     }
    },
    "d21de94ef23b41d098c5ce073e48ad95": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "d736a23a0e8f40b2bf65b3064f3513c7": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "d791ebd524c14fb39fa057b6d768d7e1": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "d7a870de29374972903edf99e079381a": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_c8a5e24211f24c488bb8c633d20d5185",
      "placeholder": "​",
      "style": "IPY_MODEL_2fd2168d36e2400eb267577e6a05d7f6",
      "value": " 0/2 [00:00&lt;?, ?it/s]"
     }
    },
    "d84fd422478e4498bd387d71bc6973eb": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_af835a288f37413d86415bf06fd69524",
      "max": 990389880,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_50393dcc6d8f480fa4d75d3cd1091520",
      "value": 990389880
     }
    },
    "d9870f9f7cbb45758e676b3ca54f9be1": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "d9e6782917cb4db4a598efa86956e8b0": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "db7b430a21394d47b3f510d3cd54918d": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "dd67da684d514c0e9104af667687ec66": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_ef34932d46c24af7ba5ecfe75b66dd7d",
      "placeholder": "​",
      "style": "IPY_MODEL_70a47bb0c68244f1b2e3bd063c703204",
      "value": "Dynasty tang: 100%"
     }
    },
    "e4cd150df2d34df0bc66b22f60089e4e": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "edb118578ca44cffa3ed79797997ce77": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_16b9d8d8b1154477b6feb23b76ed6f7a",
       "IPY_MODEL_3286b506ffc04ab486d307d42e0ffa52",
       "IPY_MODEL_0c3e05f620254eb0b9b0ba1a9e23655e"
      ],
      "layout": "IPY_MODEL_7bd662007194408eabd5b4adf81f73dd"
     }
    },
    "eef25f8bfc564f2bace3b033a0df5eb8": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_95ff98cd1eba4fe999654378fe90ea50",
       "IPY_MODEL_d84fd422478e4498bd387d71bc6973eb",
       "IPY_MODEL_22ec341fcbd140649bc29b866efbba4c"
      ],
      "layout": "IPY_MODEL_3596547df9124079846a0168971218ec"
     }
    },
    "ef34932d46c24af7ba5ecfe75b66dd7d": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "efc374010b0a48bb8185cb251176a5c6": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_2c7065d205de48e3be3f24e552dfe2eb",
      "placeholder": "​",
      "style": "IPY_MODEL_fe4e464186c34afa94351f1816565336",
      "value": " 58/58 [00:22&lt;00:00,  4.28it/s]"
     }
    },
    "f214b269fd884b1c9a3a634d6784b18e": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": "2",
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "f469bbd3377e48e9a0e1f1ec447a5d4c": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_8d64b2cb15a544688df9b0ef4f5ac5d4",
       "IPY_MODEL_3ff6b9f98fb246149676f2d0d6ea5a74",
       "IPY_MODEL_2709c8c8b756415aac3244c322d0cd6e"
      ],
      "layout": "IPY_MODEL_ab58b2c948274a1e858bb27bc5db1483"
     }
    },
    "f4c2d4d0e3eb483488808fccfb805039": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_275b4e7634324e51a3f2815a930046c9",
       "IPY_MODEL_192177f838774e69b9dc03164e12fe3f",
       "IPY_MODEL_54c2e0f0aabe4b8db056a28e8470184d"
      ],
      "layout": "IPY_MODEL_164b459cfb8a4a519e1e1dfb94ebf864"
     }
    },
    "fe4e464186c34afa94351f1816565336": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
